package com.woniu.controller;

import com.woniu.domain.Course;
import com.woniu.domain.CourseSection;
import com.woniu.service.CourseSectionService;
import com.woniu.service.CourseService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 章节
 */
/**
 * @author: ljy  <br/>
 * Date: 2021/6/8:12:14  <br/>
 * Description:章节
 */

@RestController
@RequestMapping("/courseSection/")
public class CourseSectionController {
    @Autowired
    CourseSectionService courseSectionService;
    @Autowired
    CourseService courseService;

//    @RequestMapping("addCourseSection")
//    public int addCourseSection( String courseName, String chapterData){
//        System.out.println("章节000000"+chapterData+"-"+courseName);
//        String[] chapterList = chapterData.split(",");
//        int i=0;
//        Course course = courseService.getByCourseName(courseName);
//        for (int j =0;j<chapterList.length;j++) {
//            CourseSection courseSection = new CourseSection();
//            courseSection.setCourseId(course.getId());
//            courseSection.setChapter(chapterList[j]);
//            courseSection.setSelectionNumber(j+1);
//            i+=courseSectionService.addCourseSection(courseSection);
//        }
//        return i;
//    }
}
